$.extend({
	loadComment:function(){
//		$(".nav ul li").each(function(index,item){
//			$(this).click(function(){
//				$(".nav ul li").removeClass("nav-actived");
//				$(this).addClass("nav-actived");
//			});
//		});
		$(".nav ul li").click(function(){
			$(".nav ul li").removeClass("nav-actived");
			$(this).addClass("nav-actived");
			var val = $(this).attr("value");
			$.ajax({
				url:"ssjf/commentlist.dat",
				data:{
					userTypeId:val,
					pageSize:26,
					pageNum:1
				},
				dataType:"json",
				success:function(result){
					if(result.res == 1){
						var vals = result.obj.results;
						var html = '';
						for(var i = 0; i < vals.length; i++){
							html += '<div class="row news_bar" onclick="javascript:location.href=\'ssjf/page/comment.html?id='+vals[i].id+'&isDetail=true&fileRemark=portrait\'">';
							html += '<div class="col-4 news_img"><img src="'+vals[i].filePath+'"></div><div class="col-8 news_content">';
							html += '<div class="row news_title"><div class="col-12">'+vals[i].company+'</div></div>';
							html += '<div class="row news_detail"><div class="col-12">'+vals[i].intro+'</div></div>';
							html += '<div class="row news_other"><div class="col-6"></div><div class="col-6"></div></div></div></div>';
						}
						$("#comment_list").empty();
						$("#comment_list").append(html);
					}
				}
			});
		});
		$(".nav-actived").click();
	}
});

$(function(){
	let url = window.location.href.split('#');
	if(url[1] == "blue") blue();
	$(".stars img").each(function(index,item){
		$(this).click(function(){
			var stars = $(".stars img");
			for (var i = 0; i < stars.length; i++) {
				if(i <= index){
					stars.eq(i).attr("src","static/ssjf/img/symbol/comment/star02.png");
				}else stars.eq(i).attr("src","static/ssjf/img/symbol/comment/star01.png");
			}
		});
	});
	$(".smile img").each(function(index,item){
		$(this).click(function(){
			var src = $(this).attr("src");
			for(var i = 0 ; i < 3 ; i++){
				$(".smile img").eq(i).attr("src","static/ssjf/img/symbol/comment/comment0" + (i*2+1) + ".png");
			}
			if(src.indexOf(index*2+1) == -1){
				$(this).parent().removeClass("smile-active");
				$(this).attr("src","static/ssjf/img/symbol/comment/comment0" + (index*2+1) + ".png");
			}else{
				$(this).parent().addClass("smile-active");
				$(this).attr("src","static/ssjf/img/symbol/comment/comment0" + (index*2+2) + ".png");
			}
			
		});
	});
	$(".comment_tab div").each(function(index,item){
		$(this).click(function(){
			$(this).toggleClass("active");
			if(url[1] == "blue") $(this).toggleClass("blue");
		});
	});
})

function blue(){
	$("#header").css("background-color","#306aae");
	$(".title .col-10").html("服务评级");
	$("#content > .font_t:nth-child(5)").css("color","#306aae");
	$(".active").addClass("blue");
	$(".comment_tab div").html("态度良好");
	$(".btn").css("background-color","#306aae");
}